﻿using System;
using System.Linq.Expressions;

namespace Alex.Library.Specifications
{
    /// <summary>
    /// lambda expression specification
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public sealed class ExpressionSpecification<T> : Specification<T>
    {
        private Expression<Func<T, bool>> expression;
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="expression">lambda expression</param>
        public ExpressionSpecification(Expression<Func<T, bool>> expression)
        {
            this.expression = expression;
        }

        /// <summary>
        /// get the lambda expression
        /// </summary>
        /// <returns>lambda expression</returns>
        public override Expression<Func<T, bool>> GetExpression()
        {
            return this.expression;
        }
    }
}
